#ifndef BONJOURRECORD_H
#define BONJOURRECORD_H

#include <QtCore/QMetaType>
#include <QtCore/QString>
#include <QtGlobal>


/** Class for each record in the lsit of servers a client can connect to. */
class BonjourRecord
{
	public:
		BonjourRecord() {}

		BonjourRecord(const QString name, const QString regType,
			      const QString domain) : serviceName(name),
					registeredType(regType),
					replyDomain(domain) {}

		/**
		 * Construct record, this is usually only called by Bonjour as a
		 * function arguement.
		 */
		BonjourRecord(const char *name, const char *regType, const char *domain)
		{
			serviceName = name;
			registeredType = regType;
			replyDomain = domain;
		}

		/** Test equality. */
		bool operator==(const BonjourRecord &other) const
		{
			return serviceName == other.serviceName
			&& registeredType == other.registeredType
			&& replyDomain == other.replyDomain;
		}

		void setServiceName(const QString newServiceName)
			{ serviceName = newServiceName; }

		void setRegisteredType(const QString newType)
			{ registeredType = newType; }

		void setReplyDomain(const QString newReplyDomain)
			{ replyDomain = newReplyDomain; }

		QString getServiceName() const { return serviceName; }
		QString getRegisteredType() const { return registeredType; }
		QString getReplyDomain() const { return replyDomain; }

	private:
		QString serviceName; /**< Bonjour identifier string. */
		QString registeredType; /**< Bonjour registration type/protocol */
		QString replyDomain; /**< Domain where service is, eg: 'local.' for LAN. */
};

/** Declare BonjourRecord as a metatype so that it can go in a QVariant. */
Q_DECLARE_METATYPE(BonjourRecord)

#endif // BONJOURRECORD_H
